<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\validate;

/**
 * 文章验证器
 */
class Ticket extends AdminBase
{
    
    // 验证规则
    protected $rule =   [
        'ticket_name'          => 'require',
        'original_price'=>'gt:0',
        'price'=>'gt:0',
        'classname'          => 'require|unique:channel_work_class',
        'cover_id'  =>'require',
    ];

    // 验证提示
    protected $message  =   [
        'ticket_name.require'         => '票据名称不能为空',
        'original_price'      => '原价不能为负数',
        'price'  => '优惠价不能为负数',
        'classname.require'         => '分类名称不能为空',
        'classname.unique'          => '分类名称已经存在',
        'cover_id.require'         => '分类图标不能为空',
    ];
    
    // 应用场景
    protected $scene = [
        'edit'  =>  ['ticket_name', 'original_price', 'price'],
        'class'  =>  ['classname', 'cover_id'],
    ];
}
